package tool.workflow.soft

import command.CommandExec
import implicits.Implicits._
import org.apache.poi.xssf.usermodel.XSSFWorkbook
import shared.Pojo._
import shared.SharedTool
import tool.Pojo._
import tool.workflow.soft.AllSubSoft.SubSoftBT
import tool.{Pojo, Tool, XlsxStyle}
import utils.Utils

import java.io.{File, FileOutputStream}
import com.softwaremill.quicklens._

/**
 * Created by yz on 30/10/2020
 */
object RemoveQc extends SubSoftBT with RemoveQcT {

  override def exec(workspaceDir: File, resultDir: File, si: String): CommandExec[Any, Boolean] = {
    CommandExec().exec { b =>
      getCommandData(workspaceDir, resultDir, si)
    }.map { b =>
      execAfterCommand(workspaceDir, resultDir, si)
    }
  }

  override def getCommand(si: String): String = {
    s"""
       |${"Rscript".condaPath()} ${Tool.rPath.unixPath}/remove_qc.R --si "${si}"
                       """.stripMargin
  }

  override def getCommandData(workspaceDir: File, resultDir: File, si: String): CommandData = {
    val command = getCommand(si)
    CommandData(workspaceDir, List(command))
  }

  override def execAfterCommand(workspaceDir: File, resultDir: File, si: String): Unit = {
    super.execAfterCommand(workspaceDir, resultDir, si)
  }

}
